package com.whxd.system.resource.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.whxd.system.resource.entity.Resource;

public interface ResourceDao extends PagingAndSortingRepository<Resource, Long> {

	@Query("select distinct m from User u JOIN u.roles r JOIN r.ahthorities a JOIN a.resources m where u.username=?1 and m.enabled=true order by m.orders asc")
	List<Resource> findMyResource(String username);

}
